<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .red{
      background-color: red;
      width: 400px;
      height: 300px;
      text-align: center;
      overflow: auto;

    }
    .green{
      background-color: green;
      width: 200px;
      height: 200px;
      /* 顶部线和父元素重叠 */
      margin-top: 100px;
      display: inline-block;
      
    }
    .box{
      width: 100px;
      height: 100px;
      background-color: red;   
      margin: auto auto;
     }
  </style>
</head>
<body>
  <div class="box"></div>
  <div class="red">
    <div class="green"></div>`
  </div>
</body>
</html>